# coding: utf-8

import unittest
from test.android import *
from test.android.flightList_to_train import FlightListToTrain
from test.android.train_ota12306_to_login12306 import OTA12306ToLogin12306


def generate_suite(cases):
    # 用例与jenkins名称映射
    case_mapping = {
        '去哪儿跳转到首页': TrainQunarIndex,
        '首页': TrainIndex,
        '我的订单': TrainOrder,
        '旅行服务': TrainTravelService,
        '用户中心': TrainUserCenter,
        '车次列表页': TrainList,
        '补票车次详情页': TrainFareDetails,
        '有票车次详情页': TrainTripsDetails,
        '12306订单列表': Train12306OrderList,
        '抢票订单列表页': TrainRushOrderList,
        '补票车次列表页': TrainFareAdjustment,
        '抢票订单填写': TrainRushOrderFill,
        '12306下单买票': Train12306OrderFill,
        '去哪儿下单买票': TrainQunarOrderFill,
        '添加乘客': TrainAppendPassenger,
        '机票列表跳火车': FlightListToTrain,
        'OAT页12306预订跳转12306登录': OTA12306ToLogin12306,

    }
    # 初始化测试套件，添加用例时注意在用例后面写上用例名称注释
    suite = unittest.TestSuite()
    cases = cases.split(',')
    if cases[0].strip('"') == 'all':
        for case in case_mapping.keys():
            suite.addTests(unittest.TestLoader().loadTestsFromTestCase(case_mapping[case]))
    else:
        for case in cases:
            case = case.strip('"')
            if case in case_mapping.keys():
                suite.addTests(unittest.TestLoader().loadTestsFromTestCase(case_mapping[case]))
    return suite


if __name__ == '__main__':
    pass
